<html>
<head>
<?php
	global $current_controller;

	//http-equiv meta tags
	XHTML::Meta('http-equiv', 'Content-Type', 'text/html; charset=utf-8');
	XHTML::Meta('http-equiv', 'content-language', 'en');
	XHTML::Meta('http-equiv', 'cache-control', 'no-cache');
	
	//named meta tags
	XHTML::Meta('name', 'robots', 'noindex,nofollow');

	//common javascript files
	XHTML::JSBuffer(JAVASCRIPTSRC.SEPARATOR.'general');
	XHTML::JSBuffer(JAVASCRIPTSRC.SEPARATOR.'shortcut');
	XHTML::JSBuffer(JAVASCRIPTSRC.SEPARATOR.'ajax');
	
	//additional javascript files
	$current_controller->IncludeJavascriptFiles();
	XHTML::DisplayJSBuffer();
	
	//common css files
	XHTML::CSSBuffer(substr(THEMES.SEPARATOR.$current_controller->theme.SEPARATOR.'default', 1));
	XHTML::DisplayCSSBuffer();
	
	//jquery component
    jQuery::Initialize();
	
	//page title
	XHTML::Title(LANG_PROJECT_NAME.' :: '.$page_title);
?>

</head>
<body>
	<noscript>
		<div class='megaError'><?php echo LANG_NO_JS; ?></div>
	</noscript>
	
	<!-- jQuery -->
    <?php
        //turns all submit/reset submit buttons into jQuery buttons
        jQuery::Button("page_container input:submit, input:reset"); 
    ?>
	<!-- /jQuery -->
	
    <!-- HEADER -->
    <?php
        Logger::Debug("Header started");
        $current_controller->IncludeThemeElement('header');
        Logger::Debug("Header ended");
    ?>
    <!-- /HEADER -->
    	
    <table width="100%" border="0" cellpadding="0" cellspacing="0" height="95%" id = "page_container">
        <tr>
        	<!-- CONTEXT MENU -->
        	<td width="50" valign="top" class="menu_left" id = 'system_contextual_menu'>
            	<?php
            		Logger::Debug("Context menu started");
            		$current_controller->IncludeThemeElement('column_left'); 
            		Logger::Debug("Context menu ended");
            	?>
        	</td>
        	<!-- /CONTEXT MENU -->
        	
        	<!-- SEPARATOR -->
        	<td width="5" valign="top" class="menu_left" id = '' style="vertical-align: middle; background-color: #EEEEEE">
        		<?php 
                    $current_controller->IncludeThemeElement('separator_vertical'); 
        		?>
        	</td>
        	<!-- /SEPARATOR -->
        	
        	<!-- CONTENT -->
        	<td valign="top" style="padding: 10px; overflow: visible;">
            	<?php
            		Logger::Debug("Load content started");
            		echo $page_content;
            		Logger::Debug("Load content ended");
            		$current_controller->AfterLoad($object->parsed_url);
            	?>
        	</td>
        	<!-- /CONTENT -->
        </tr>  
    </table>

    <!-- FOOTER -->
    
    <!-- FOOTER -->
</body>
</html>

<!-- Layout elements visibility -->
<?php 
	//defines whether to display the left column
    if ($_SESSION['show']['left_column'] === false)
    {
        XHTML::Script('', '
        	$("#system_contextual_menu").hide();
        	$("#context_menu_separator_image").attr("src", "'.IMAGES.'arrow_right_black.gif");
        ');
    }
    
	//defines whether to display the header
    if ($_SESSION['show']['header'] === false)
    {
        XHTML::Script('', '
        	$("#page_header").hide();
        	$("#header_separator_image").attr("src", "'.IMAGES.'arrow_bottom_black.gif");
        ');
    }
    
?>
<!-- /Layout elements visibility -->